<?php
namespace app\api\controller;
/**
 * Created by qihaoyingdi
 * Class Repository
 * Description:仓库的接口控制器
 * @package app\api\controller
 * Author:sunnier
 * Email:xiaoyao_xiao@126.com
 * 2020-11-02 14:42
 */
class Repository extends Base
{
    protected $crawlRepoService;

    public function initialize()
    {
        parent::initialize();

        $this->crawlRepoService = app('app\common\service\CrawlRepoService');
    }

    /**
     * @return \think\response\Json
     * Description:获取列表
     * Author:sunnier
     * Email:xiaoyao_xiao@126.com
     * 2020-11-02 14:44
     */
    public function getList(){
        $getData=input('get.');
        if(!empty($getData['language'])) {
            $lang = htmlspecialchars($getData['language']);
        }else{
            $lang='all';
        }
        if(!empty($getData['date'])) {
            $date = htmlspecialchars($getData['date']);
        }else{
            $date='daily';
        }
        $result=$this->crawlRepoService->getList($lang,$date);
        return api_res($result['status'],$result['msg'],$result['data']);
    }
}